package samber

import (
	"fmt"
	"github.com/samber/lo"
)

// Without 数组剔除不想要的
func Without() {
	list := []foo{{}, {bar: "1"}, {bar: "2"}, {bar: "1"}}
	res := lo.Without(list, foo{}, foo{bar: "1"})
	fmt.Printf("%v\n", res) // [{2 }]
}

// WithoutEmpty 数组剔除数组中的空
func WithoutEmpty() {
	list := []foo{{}, {bar: "1"}, {bar: "2"}, {bar: "1"}}
	res := lo.WithoutEmpty(list)
	fmt.Printf("%v\n", res) // [{1 } {2 } {1 }]

	list2 := []*foo{nil, nil, &foo{}, &foo{bar: "1"}}
	res2 := lo.WithoutEmpty(list2)
	fmt.Printf("%v\n", res2) // [0xc0000c2080 0xc0000c20a0]
}
